AliAnalysisTask *AddTask_xlu_ESDTRDsignal()
{
  char *tkn0 = "ESDTRDsignal";

  //---  
  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
  if (!mgr) {
    Error(From("AddTask_xlu_%s",tkn0), "No analysis manager found.");
    return 0;
  }

  gSystem->AddIncludePath("-I$ALICE_ROOT/TPC -I$ALICE_ROOT/TRD");

  //const TString traindir("/d/alice11/xlu/mytrain/trunk/xlu_diffractive/");
  const TString traindir("");
  const TString libs[]={Form("AliAnalysisTask%s",tkn0)};
  const Int_t nlb=sizeof(libs)/sizeof(TString);
  for(Int_t ii=0; ii<nlb; ii++){
    const TString llb=traindir+libs[ii];

    Int_t kl = gROOT->LoadMacro(Form("%s_cxx.so",llb.Data()));
    printf("Load %s: %d\n", llb.Data(), kl);

    if(kl<0){
      printf("compiling %s ...\n",llb.Data());
      kl = gROOT->LoadMacro(Form("%s.cxx++",llb.Data()));
      if(kl<0){
        printf("compile %s fail!! %d\n", llb.Data(), kl);
        exit(1);
      }
      else{
        printf("compile %s done!! %d\n", llb.Data(), kl);
      }
    }

  }
  
  printf("========== test-2\n");
  
  if (gProof){
    TString taskSO=gSystem->pwd();
    taskSO+="/";
    taskSO+=Form("AliAnalysisTask%s_cxx.so",tkn0);
    gProof->Exec(Form("gSystem->Load(\"%s\")",taskSO.Data()),kTRUE);
  }

  printf("========== test-1\n");
  
  //---  
  AliAnalysisTaskESDTRDsignal *mytask = new AliAnalysisTaskESDTRDsignal;

  printf("========== test-0.5\n");
  mytask->SelectCollisionCandidates(AliVEvent::kMB);
  
  printf("========== test0\n");
  
  mgr->AddTask(mytask);

  printf("========== test1\n");
  //---  
  AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
  mgr->ConnectInput(mytask,  0, cinput );
  
  printf("========== test2\n");

  Char_t foutname[100];
  sprintf(foutname,"xlu_%s.root",tkn0);

  printf("========== test3\n");

  AliAnalysisDataContainer *outlist1 = mgr->CreateContainer("xlu_tree",            TTree::Class(), AliAnalysisManager::kOutputContainer,foutname);

  printf("========== test4\n");

  //in AnalysisTaskSE, slot 0 reserved, must start from 1
  mytask->ConnectOutput(1, outlist1);

  printf("========== test5\n");

  return mytask;
}
